
*** OUTCOMES FROM UNFOLDING BRACKETS FOR AGE 55

use "Data/NCDS/UKDA-7669-stata11/stata11/ncds_2013_unfolding.dta", clear

* employed: gross pay
local vars W F M Y O
foreach v of local vars{
replace N9GA`v'BMN=. if  N9GA`v'BMN<0
replace N9GA`v'BMX=. if  N9GA`v'BMX<0
}
egen gpee_min=rowmax(N9GA*BMN)
egen gpee_max=rowmax(N9GA*BMX)

* employed: take home (net) pay
foreach v of local vars{
replace N9NA`v'BMN=. if  N9NA`v'BMN<0
replace N9NA`v'BMX=. if  N9NA`v'BMX<0
}
egen npee_min=rowmax(N9NA*BMN)
egen npee_max=rowmax(N9NA*BMX)

* employed: usual take home (net) pay
foreach v of local vars{
replace N9USL`v'MN=. if  N9USL`v'MN<0
replace N9USL`v'MX=. if  N9USL`v'MX<0
}
egen unpee_min=rowmax(N9USL*MN)
egen unpee_max=rowmax(N9USL*MX)

* self employed: take home income last year
ge ese_min= N9SEYBMN if  N9SEYBMN!=. &  N9SEYBMN>=0
ge ese_max= N9SEYBMX if  N9SEYBMX!=. &  N9SEYBMX>=0

keep NCDSID  *_max *_min
sort NCDSID

save scratchdata/ncds_2013_unfolding.dta, replace
